#include "LED.h"
#include "../config/config.h"

void LED::init()
{
    Serial.println("LED init....");
    pinMode(BottomLeftPin, OUTPUT);
    pinMode(BottomRightPin, OUTPUT);

    analogWrite(BottomLeftPin, 0);
    analogWrite(BottomRightPin, 0);
}

// 后边两个灯的双闪
void LED::open()
{
    analogWrite(BottomLeftPin, 255);
    analogWrite(BottomRightPin, 255);
    delay(300);
    analogWrite(BottomLeftPin, 0);
    analogWrite(BottomRightPin, 0);
    delay(300);
}

void LED::close()
{
    analogWrite(BottomLeftPin, 0);
    analogWrite(BottomRightPin, 0);
}

// 开左转灯
void LED::TurnLeft()
{
    analogWrite(BottomLeftPin, 255);
}

// 关左转灯
void LED::TurnLeftClose()
{
    analogWrite(BottomLeftPin, 0);
}

// 开右转灯
void LED::TurnRight()
{
    analogWrite(BottomRightPin, 255);
}

// 关右转灯
void LED::TurnRightClose()
{
    analogWrite(BottomRightPin, 0);
}
